
package com.soft.config;

import com.soft.bean.Car;
import com.soft.bean.Pet;
import com.soft.bean.User;
import java.util.Date;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

@Configuration
@Import(Pet.class)
@EnableConfigurationProperties({ Car.class })
public class TestConfig {
  @Bean("user")
  @ConditionalOnBean(Pet.class)
  public User getUser(Pet pet) {
    User user = new User(1, "admin", "123456", "渝北区", new Date());
    user.setPet(pet);
    return user;
  }
}
